package com.zmn.oms.services.impl.chan;

import com.zmn.oms.model.dto.chan.OrderClueDetailListQuery;
import com.zmn.oms.model.entity.chan.OrderClueDetail;
import com.zmn.oms.persistence.interfaces.chan.OrderClueDetailDAO;
import com.zmn.oms.services.interfaces.chan.OrderClueDetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述：
 *
 * @author LiangHailong
 * @date 2021/01/08 22:28
 */
@Service("orderClueDetailService")
public class OrderClueDetailServiceImpl implements OrderClueDetailService {

    @Resource
    private OrderClueDetailDAO orderClueDetailDAO;

    @Override
    public OrderClueDetail findByKey(Long key) {
        if (key == null) {
            return null;
        }
        return orderClueDetailDAO.findByKey(key);
    }

    /**
     * 条件查询
     * @param query
     * @return
     */
    @Override
    public List<OrderClueDetail> listOrderClueDetails(OrderClueDetailListQuery query) {
        int count = orderClueDetailDAO.listCount(query);
        query.setTotalCount(count);
        return orderClueDetailDAO.list(query);
    }

    @Override
    public int save(OrderClueDetail orderClueDetail) {
        return orderClueDetailDAO.insert(orderClueDetail);
    }

    @Override
    public int updateByKey(OrderClueDetail orderClueDetail) {
        return orderClueDetailDAO.updateByKey(orderClueDetail);
    }
}
